import request from './request'

export const add = (params,type) => {
	var beginTime = params.beginTime.split('-')
	var startHover = beginTime[2].split(' ')[1]=="上午"? '08:00':'14:00'
	params.beginTime = beginTime[0] + '年' + beginTime[1] + '月' + beginTime[2].split(' ')[0] + '日' + ' ' + startHover
	var endTime = params.endTime.split('-')
	var endHover = endTime[2].split(' ')[1]=="上午"? '11:30':'18:00'
	params.endTime = endTime[0] + '年' + endTime[1] + '月' + endTime[2].split(' ')[0] + '日' + ' ' + endHover
	if(type != '按半天') {
		params.beginTime = params.beginTime.split(' ')[0] + ' ' + '08:00'
	}
  return request.post('/zxch/vacation/app',params)
}

export const getList = (params) => {
  return request.get('/zxch/vacation/app/list',params)
}

export const getInfo = (id) => {
  return request.get(`/zxch/vacation/app/${id}`)
}

export const revoke = (id) => {
  return request.put(`/zxch/vacation/app/revoke/${id}`)
}